const { api, isMock, proxy, moduleName } = require('env.cfg')

const needProxy = (proxy && proxy['needOpen']) || isMock
const moduleCfg = window[moduleName]
const staticHost = moduleCfg && moduleCfg.staticHost ? moduleCfg.staticHost : ''
const host = moduleCfg && moduleCfg.apiHost ? moduleCfg.apiHost : ''

const apiHost = (needProxy ? '' : host) + api
const commHost = needProxy ? '' : host
// console.info('apiHost:', apiHost)

export default {
  resourceUrl: `${staticHost}`,
  userLogin: `${apiHost}/auth/login`,
  userLogout: `${apiHost}/auth/logout`,
  userModifyPass: `${apiHost}/user/modifyPass`,
  getAuthInfo: `${apiHost}/auth/info`,
  getCourtomer: `${apiHost}/customer`,

  uploadFile: `${commHost}/upload/file`,

  getCoursePage: `${apiHost}/trainee/coursePage`,
  getCourseInfos: `${apiHost}/trainee/getCourse`,
  getExercise: `${apiHost}/trainee/getExercise`,
  getCourseGroup: `${apiHost}/trainee/getGroup`,
  bindGroup: `${apiHost}/trainee/bindGroup`,
  getStudyCourseList: `${apiHost}/trainee/study/courseList`,
  studySwitchLesson: `${apiHost}/trainee/study/switchLesson`,

  getAllExercise: `${apiHost}/trainee/getAllExercise`,
  getExerciseSearch: `${apiHost}/trainee/exercise/getSearch`,
  getExerciseReport: `${apiHost}/trainee/exercise/getReport`,
  getExerciseReportState: `${apiHost}/trainee/exercise/getReportState`,
  commitExercise: `${apiHost}/trainee/exercise/save`,

}
